<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Registers to listen to a given destination</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="stomp.setreadtimeout.html">« Stomp::setReadTimeout</a></li>
      <li style="float: right;"><a href="stomp.unsubscribe.html">Stomp::unsubscribe »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.stomp.html">Stomp</a></li>
    <li>Registers to listen to a given destination</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="stomp.subscribe" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Stomp::subscribe</h1>
  <h1 class="refname">stomp_subscribe</h1>
  <p class="verinfo">(PECL stomp &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">Stomp::subscribe</span> -- <span class="refname">stomp_subscribe</span> &mdash; <span class="dc-title">Registers to listen to a given destination</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-stomp.subscribe-description">
  <h3 class="title">说明</h3>
  <p class="para">面向对象风格 (method):</p>
   <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Stomp::subscribe</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$destination</code></span>, <span class="methodparam"><span class="type">array</span> <code class="parameter">$headers</code><span class="initializer"> = ?</span></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">过程化风格:</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>stomp_subscribe</strong></span>(<span class="methodparam"><span class="type">resource</span> <code class="parameter">$link</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$destination</code></span>, <span class="methodparam"><span class="type">array</span> <code class="parameter">$headers</code><span class="initializer"> = ?</span></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Registers to listen to a given destination.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-stomp.subscribe-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    <dt>
<code class="parameter">link</code></dt>
<dd>
<p class="para">仅对过程化样式：由 <span class="function"><a href="stomp.construct.html" class="function">stomp_connect()</a></span> 返回的 stomp 连接标识符。</p></dd>

    
     <dt>
<code class="parameter">destination</code></dt>

     <dd>

      <p class="para">
       Destination to subscribe to. 
      </p>
     </dd>

    
    <dt>
<code class="parameter">headers</code></dt>
<dd>
<p class="para">关联数组包含附加的头信息（例如： receipt）。</p></dd>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-stomp.subscribe-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-stomp.subscribe-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   See <span class="function"><a href="stomp.ack.html" class="function">stomp_ack()</a></span>.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-stomp.subscribe-notes">
  <h3 class="title">注释</h3>
  <div class="tip"><strong class="tip">小技巧</strong><p class="simpara">Stomp is inherently asynchronous. Synchronous communication can be implemented adding a receipt header. This will cause methods to not return anything until the server has acknowledged receipt of the message or until read timeout was reached.</p></div>
 </div>


</div></div></div></body></html>